<div id="content" style="background-color:#ffffff">
<div id="content-header">
  <div id="breadcrumb"> <a href="?m=admin&t=main" title="Go to Home" class="tip-bottom"><i class="icon-home"></i> 系统首页</a> <a href="#" class="current">应用列表</a> </div>
</div>
<div class="container-fluid" >
  
  <div class="row-fluid" >
  
  

 
 
<fieldset class="layui-elem-field layui-field-title">
  <legend>开票列表</legend>
</fieldset>
	  
    <table class="layui-table">
	 
	  <thead>
	    <tr>
		  <th>商户名称</th>
	      <th>金额</th>
		  <th>状态</th>
		  <th>时间</th>
		  <th width="20%">操作</th>
	    </tr> 
	  </thead>
	  <tbody>
		<{section name=list loop=$applist}>
			<tr>
			  <td><{$applist[list].business_name}></td>
			  <td><{$applist[list].price}></td>
			 
			  <td><{if $applist[list].status==1}>待开票<{elseif $applist[list].status==2}>已开票<{elseif $applist[list].status==3}><span style='color: #f90d0d;'>已冲红</span><{/if}></td>
			  
			   <td>创建时间：<{$applist[list].c_time|date_format:'%Y-%m-%d %H:%M:%S'}><br>
			   	   <{if $applist[list].status>1}>开票时间：<{$applist[list].open_time|date_format:'%Y-%m-%d %H:%M:%S'}><br><{/if}>
			   	   <{if $applist[list].status>2}>冲红时间：<{$applist[list].revoke_time|date_format:'%Y-%m-%d %H:%M:%S'}><{/if}>
			   </td>
			  
			  
			  <td>
			  <button ticket_number='<{$applist[list].number}>' class="ticket_number layui-btn layui-btn-normal layui-btn-small">查看二维码</button>
              
			  <button <{if $applist[list].status==3}>disabled<{/if}> ticket_number='<{$applist[list].number}>' class="<{if $applist[list].status==3}> layui-btn-disabled <{/if}>revoke layui-btn layui-btn-danger layui-btn-small">冲红</button>
			  <button <{if $applist[list].status!=2}>disabled<{/if}> ticket_number='<{$applist[list].number}>' class="<{if $applist[list].status!=2}> layui-btn-disabled <{/if}>query layui-btn  layui-btn-small">查看发票</button>
              
            <!--  
<span id='num_<{$applist[list].number}>"'  style="display:none">
              	<a href="http://weixin_online/app/index.php?i=3&c=entry&do=open_ticket&m=xf_ticket&number=<{$applist[list].number}>">开票地址</a>
                <img scr="http://qr.liantu.com/api.php?text=http://weixin.xiangfubao.com.cn/app/index.php?i=3%26c=entry%26do=open_ticket%26m=xf_ticket%26number=<{$applist[list].number}>">
              
              
              </span>-->
              
              </td>
			</tr>
		<{/section}>
	  </tbody>
	</table>
<div align='center'><{$page_menu}></div>
      
  </div>
</div>
<script>
layui.use(['layer'], function(){
 	var layer = layui.layer
 	$(".ticket_number").click(function(){
		var ticket_number = $(this).attr('ticket_number');
		layer.open({
			type:1,
			title:'二维码',
			area: ['300px', '400px'],
			//content:$("#num_"+ticket_number)
			content:"<a target='_blank' href='http://weixin_online/app/index.php?i=3&c=entry&do=open_ticket&m=xf_ticket&number="+$.trim(ticket_number)+"'>开票地址</a><br><img src='http://qr.liantu.com/api.php?text=http://weixin.xiangfubao.com.cn/app/index.php?i=3%26c=entry%26do=open_ticket%26m=xf_ticket%26number="+$.trim(ticket_number)+"'>"	
		}) 
		
	})
	
	$(".revoke").click(function(){
		var ticket_number = $(this).attr('ticket_number');
		layer.prompt({title: '请填写冲红原因', formType:2}, function(data, index){
			location.href='/index.php?m=admin&o=ticket&t=revokeTicket&number='+ticket_number+'&revokeReson='+data
		});
		
	})
	
	$(".query").click(function(){
		var ticket_number = $(this).attr('ticket_number');
		layer.open({
			type:2,
			area: ['50%', '90%'],
			shadeClose: true,
			shade: false,
			maxmin: true, //开启最大化最小化按钮
			content:"/index.php?m=admin&o=ticket&t=queryTicket&number="+ticket_number
			
		})
		
	})
  
  
});
</script>